package com.dfrz.config;

import com.dfrz.common.ResultEnum;
import lombok.Data;
import lombok.Getter;
import org.springframework.stereotype.Component;

/**
 * @author 29877
 */
@Getter
public class CustomException extends RuntimeException{
    private final Integer code;
    public CustomException(Integer code,String msg) {
        super(msg);
        this.code = code;
    }

    /**
     * 接受的枚举类型
     */
    public CustomException (ResultEnum resultEnum){
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }
}
